home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 90 / CD Actual 90.iso / Software3D / K-3D / k3d-0.4.2.1 / shaders / k3d_shiny.sl < prev    next >
Encoding:
Text File  |  2004-07-23  |  1.6 KB  |  44 lines

  1. /****************************************************************************
  2.  * shiny.sl -- Shiny metal surface
  3.  *
  4.  * Parameters:
  5.  *    Ka, Kd, Ks, roughness - The usual meaning
  6.  *    Kr - coefficient for mirror-like reflections of environment
  7.  *    blur - how blurry are the reflections? (0 = perfectly sharp)
  8.  *    envname, envspace, envrad - controls for using environment maps
  9.  *    rayjitter, raysamples - ray tracing controls for reflection
  10.  *    twosided - if nonzero both sides of the surface are shiny, otherwise
  11.  *        only the "outside" (where the surface normal points) will
  12.  *        spawn rays.  This can be an important optimization, especially
  13.  *        when using the "ray server."
  14.  *
  15.  ***************************************************************************
  16.  *
  17.  * Author: Larry Gritz (gritzl@acm.org).
  18.  *
  19.  * Reference:
  20.  *   _Advanced RenderMan: Creating CGI for Motion Picture_, 
  21.  *   by Anthony A. Apodaca and Larry Gritz, Morgan Kaufmann, 1999.
  22.  *
  23.  * $Revision: 1.1 $    $Date: 2002/11/25 20:24:00 $
  24.  *
  25.  ****************************************************************************/
  26.  
  27. /* Get rid of rayserver.h if you don't want PRMan and BMRT to work together */
  28. #include "k3d_rayserver.h"
  29. #include "k3d_material.h"
  30.  
  31.  
  32.  
  33. surface k3d_shiny(float Ka = 1, Kd = 0.1, Ks = 1, roughness = 0.2;
  34.           float Kr = 0.8, blur = 0; DECLARE_DEFAULTED_ENVPARAMS;
  35.           float twosided = 0;)
  36. {
  37.   normal Nf = faceforward(normalize(N), I);
  38.   Ci =
  39.     MaterialShinyMetal(Nf, Cs, Ka, Kd, Ks, roughness, Kr, blur, twosided,
  40.                ENVPARAMS);
  41.   Oi = Os;
  42.   Ci *= Oi;
  43. }
  44.